const user = {
    state: {
        historyPathList: [],
        imgList:[],
    },

    mutations: {
        SET_HISTORYPATHLIAT: (state, historyPathList) => {
            state.historyPathList = historyPathList;
            let _historyPathList= [];
            historyPathList.forEach(item=>{
                let param={
                    fullPath:item.fullPath,
                    name:item.name,
                    query:item.query,
                }
                _historyPathList.push(param)
            })
            sessionStorage.setItem('historyPathList',JSON.stringify(_historyPathList))
        },
        SET_IMGLIST: (state, imgList) => {
            state.imgList = imgList;
            sessionStorage.setItem('imgList', imgList)
        },

    },

    actions: {

        // 动态历史路径
        changeHistoryPathList: ({commit}, historyPathList) => {
            commit('SET_HISTORYPATHLIAT', historyPathList)
        },
        changeImgList: ({commit}, imgList) => {
            commit('SET_IMGLIST', imgList)
        },

    },

}

export default user

/*
* 使用例子
* */
// store.dispach('changAvatar',param)
